<?php

class ErrorController extends Zend_Controller_Action
{
    private static $httpCode;
    private static $errorMessage;

    public function errorAction()
    {
        $error = $this->_getParam('error_handler');
        
        switch ($error->type) {
            case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
            case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION:
                self::$httpCode = 404;
                self::$errorMessage = 'Page not found';
                break;
            default:
                self::$httpCode = 500;
                self::$errorMessage = 'Unknown error';
        }

        $this->getResponse()->setHttpResponseCode(self::$httpCode);
        $this->view->httpCode = self::$httpCode;
        $this->view->errorMessage = self::$errorMessage;
    }
}
